package com.demo2do.boyle.common.entity.aduser.order;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.demo2do.boyle.common.entity.aduser.Aduser;

/**
 * 
 * @author Leo
 *
 */

@Entity
@Table( name = "aduser_order")
public class AduserOrder {

	@Id
	@GeneratedValue
	private Integer id;
	
	@ManyToOne(optional = true, fetch = FetchType.LAZY)
	private Aduser aduser;
	
	/** 请求号 */
	private String payNumber;
	
	/** 买家账号 */	
	private String buyerEmail;
	
	private String buyer_id;
	
	@Enumerated(EnumType.ORDINAL)
    private PayType payType;
	
	private int balance;
	
	private Date createTime;

	@Column(name = "third_pay_number")
	private String thirdPayNumber;
	
	/**
     * default constructor
     */
	public AduserOrder() {
		
	}
	
	/**
	 * The constructor using balance
	 * @param balance
	 */
	public AduserOrder(int balance) {
		this.balance = balance;
		
	}

	/**
	 * Initialize the basic fields 
	 * 
	 * @return the order
	 */
	public AduserOrder initialize(Aduser aduser) {
	
		this.aduser = aduser;
		this.buyer_id = null;	
		this.buyerEmail = null;		
		this.createTime = new Date();		
		this.payType = PayType.ALIPAY;
		this.thirdPayNumber = null;	
		
		return this;
	}

	/**
	 * @return the id
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * @return the aduser
	 */
	public Aduser getAduser() {
		return aduser;
	}

	/**
	 * @return the payNumber
	 */
	public String getPayNumber() {
		return payNumber;
	}

	/**
	 * @return the buyerEmail
	 */
	public String getBuyerEmail() {
		return buyerEmail;
	}

	/**
	 * @return the buyer_id
	 */
	public String getBuyer_id() {
		return buyer_id;
	}

	/**
	 * @return the payType
	 */
	public PayType getPayType() {
		return payType;
	}

	/**
	 * @return the balance
	 */
	public int getBalance() {
		return balance;
	}

	/**
	 * @return the createTime
	 */
	public Date getCreateTime() {
		return createTime;
	}

	/**
	 * @return the thirdPayNumber
	 */
	public String getThirdPayNumber() {
		return thirdPayNumber;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * @param aduser the aduser to set
	 */
	public void setAduser(Aduser aduser) {
		this.aduser = aduser;
	}

	/**
	 * @param payNumber the payNumber to set
	 */
	public void setPayNumber(String payNumber) {
		this.payNumber = payNumber;
	}

	/**
	 * @param buyerEmail the buyerEmail to set
	 */
	public void setBuyerEmail(String buyerEmail) {
		this.buyerEmail = buyerEmail;
	}

	/**
	 * @param buyer_id the buyer_id to set
	 */
	public void setBuyer_id(String buyer_id) {
		this.buyer_id = buyer_id;
	}

	/**
	 * @param payType the payType to set
	 */
	public void setPayType(PayType payType) {
		this.payType = payType;
	}

	/**
	 * @param balance the balance to set
	 */
	public void setBalance(int balance) {
		this.balance = balance;
	}

	/**
	 * @param createTime the createTime to set
	 */
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	/**
	 * @param thirdPayNumber the thirdPayNumber to set
	 */
	public void setThirdPayNumber(String thirdPayNumber) {
		this.thirdPayNumber = thirdPayNumber;
	}
	
	
	
}
